package com.liqi.device.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liqi.device.domain.TWorkingCalendar;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @description 节假日调班日表Mapper
 * @author zhengkai.blog.csdn.net
 * @date 2023-03-22
 */

public interface TWorkingCalendarMapper extends BaseMapper<TWorkingCalendar> {

    @Select(
            "<script>select t0.* from t_working_calendar t0 " +
                    //add here if need left join
                    "where 1=1" +
                    "<when test='id!=null and id!=&apos;&apos; '> and t0.id=#{id}</when> " +
                    "<when test='name!=null and name!=&apos;&apos; '> and t0.name=#{name}</when> " +
                    "<when test='branchCode!=null and branchCode!=&apos;&apos; '> and t0.branch_code=#{branchCode}</when> " +
                    "<when test='calendarDate!=null and calendarDate!=&apos;&apos; '> and t0.calendar_date=#{calendarDate}</when> " +
                    "<when test='calendarType!=null and calendarType!=&apos;&apos; '> and t0.calendar_type=#{calendarType}</when> " +
                    "<when test='cnDay!=null and cnDay!=&apos;&apos; '> and t0.cn_day=#{cnDay}</when> " +
                    "<when test='createUserId!=null and createUserId!=&apos;&apos; '> and t0.create_user_id=#{createUserId}</when> " +
                    "<when test='status!=null and status!=&apos;&apos; '> and t0.status=#{status}</when> " +
                    "<when test='createBy!=null and createBy!=&apos;&apos; '> and t0.create_by=#{createBy}</when> " +
                    "<when test='createTime!=null and createTime!=&apos;&apos; '> and t0.create_time=#{createTime}</when> " +
                    "<when test='updateBy!=null and updateBy!=&apos;&apos; '> and t0.update_by=#{updateBy}</when> " +
                    "<when test='updateTime!=null and updateTime!=&apos;&apos; '> and t0.update_time=#{updateTime}</when> " +
                    "<when test='remark!=null and remark!=&apos;&apos; '> and t0.remark=#{remark}</when> " +
                    //add here if need page limit
                    //" limit ${page},${limit} " +
                    " </script>")
    List<TWorkingCalendar> pageAll(TWorkingCalendar queryParamDTO, int page, int limit);

    @Select("<script>select count(1) from t_working_calendar t0 " +
            //add here if need left join
            "where 1=1" +
            "<when test='id!=null and id!=&apos;&apos; '> and t0.id=#{id}</when> " +
            "<when test='name!=null and name!=&apos;&apos; '> and t0.name=#{name}</when> " +
            "<when test='branchCode!=null and branchCode!=&apos;&apos; '> and t0.branch_code=#{branchCode}</when> " +
            "<when test='calendarDate!=null and calendarDate!=&apos;&apos; '> and t0.calendar_date=#{calendarDate}</when> " +
            "<when test='calendarType!=null and calendarType!=&apos;&apos; '> and t0.calendar_type=#{calendarType}</when> " +
            "<when test='cnDay!=null and cnDay!=&apos;&apos; '> and t0.cn_day=#{cnDay}</when> " +
            "<when test='createUserId!=null and createUserId!=&apos;&apos; '> and t0.create_user_id=#{createUserId}</when> " +
            "<when test='status!=null and status!=&apos;&apos; '> and t0.status=#{status}</when> " +
            "<when test='createBy!=null and createBy!=&apos;&apos; '> and t0.create_by=#{createBy}</when> " +
            "<when test='createTime!=null and createTime!=&apos;&apos; '> and t0.create_time=#{createTime}</when> " +
            "<when test='updateBy!=null and updateBy!=&apos;&apos; '> and t0.update_by=#{updateBy}</when> " +
            "<when test='updateTime!=null and updateTime!=&apos;&apos; '> and t0.update_time=#{updateTime}</when> " +
            "<when test='remark!=null and remark!=&apos;&apos; '> and t0.remark=#{remark}</when> " +
            " </script>")
    int countAll(TWorkingCalendar queryParamDTO);

}